#!/usr/bin/perl -w
use Modern::Perl;

my @a = split /\s+/, <>;
my @b;

foreach (@a) {
  if (/\d+/) {
    unshift @b, $_;
  } elsif (m{[+-/*]}) {
    my $c = shift @b or die("Faltan args!");
    my $d = shift @b or die("Faltan args!");
    unshift @b, eval($c.' '.$_.' '.$d);
  }
}

print $b[0]."\n";
